package zhou.contest14;

import java.sql.SQLException;

public class UserService {
	
	    UserDao ud=new UserDao();
	    //用户登录：
	    public boolean login(String username,String pwd) throws SQLException{
			boolean result=false;
			UserDao ud=new UserDao();
			User u=ud.getUserbyName(username);
			if(pwd.equals(u.getPwd())){
				result=true;
			}
			return  result;
		}
		//测试方法；
		public static void main(String[] args) throws SQLException {
			UserService us=new UserService();
			//User user=new User("huang","564");
			System.out.println(us.login("huang","564"));
		}
		
		//添加评价和留言：
		public boolean evaluate(User u,String evaluate,String message) throws SQLException{
			boolean result=false;
			if(ud.read(u.getUsername(), evaluate, message)){
				result=true;
			}
			else{
				return result;
			}
			return result;
		}
}
